<?php

namespace app\common\model\shopro;

use think\Model;

/**
 * 店铺
 */
class Shop extends Model
{

    // 开启自动写入时间戳字段
    protected $name = 'shopro_shop';
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    // 追加属性
    protected $append = [
        'createtime_text',
        'logo_text'
    ];

    public function getCreatetimeTextAttr($value,$data)
    {
        if (isset($data['createtime'])) {
            $value = date('Y-m-d H:i:s',$data['createtime']);
        }
        return $value;
    }
    public function getLogoTextAttr($value,$data)
    {
        if (isset($data['logo'])) {
            $value = cdnurl($data['logo'],true);
        }
        return $value;
    }
}
